fix(devx): route missing GITHUB_REPOSITORY/GITHUB_TOKEN to EXIT_NOT_WIRED - #17362
Merged
Merged
Conversation
…IRED
check:single-claim-paths only guarded PR_NUMBER, so a run with PR_NUMBER
set but GITHUB_REPOSITORY unset assembled a request against an empty
repo slug, threw an unhandled rejection, and exited 1 — this gate's
FINDING code — instead of the exit-2 NOT WIRED path it already
documents and reserves for exactly this. GITHUB_TOKEN is guarded the
same way, since every real run needs it to read a PR's file list.
readPrContext now returns a { wired: false, missing, number } shape for
this half-wired case, and judge() routes it through the same NOT WIRED
verdict text as the fully-unset case (still saying "judged nothing",
never printing a clean-board mark). GITHUB_REPOSITORY/GITHUB_TOKEN are
checked by truthiness rather than PR_NUMBER's Object.hasOwn presence
check — the docblock says why the convention differs: both values are
consumed directly to build the request, so an empty string reproduces
the exact defect a presence check would wave through.
Adds a --self-test battery for the missing-slug and missing-token
inputs, including an assertion pinning the exit code as the literal
number 2, and a reverse-control case proving all three variables
present still resolves to a full, usable context.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012GKcPZbMoGq7WPzKLfRBTU
baozhoutao
marked this pull request as ready for review
September 10, 2026 08:51
baozhoutao
enabled auto-merge
September 10, 2026 08:51
baozhoutao
deleted the
claude/issue-16329-single-claim-paths-not-wired
branch
September 10, 2026 09:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16329
What changed
check:single-claim-paths'sreadPrContextonly guardedPR_NUMBERviaObject.hasOwn. WithPR_NUMBERset andGITHUB_REPOSITORYunset,ctx.reporesolved to'', the request was built anyway (/repos//pulls/…), and the run died on an unhandled rejection — exiting 1, this gate's FINDING code, instead of the exit-2NOT WIREDpath its own header already reserves for exactly this.readPrContextnow returns a three-way result:null(nothing wired at all),{ wired: false, missing, number }(PR_NUMBERpresent butGITHUB_REPOSITORYorGITHUB_TOKENmissing), or the full context.judge()routes bothnullandwired: falsethrough the sameEXIT_NOT_WIRED(2) verdict text — still saying "judged nothing", never printing a✓.GITHUB_REPOSITORYandGITHUB_TOKENare checked by truthiness (trimmed, non-empty), notPR_NUMBER'sObject.hasOwnpresence check. This is a deliberate, documented departure from thePR_NUMBERconvention, not a silent swap — see the docblock abovereadPrContext:PR_NUMBER's value is never read to build a request, it only witnesses that the workflow ran, so presence is the right test.GITHUB_REPOSITORY/GITHUB_TOKENare consumed directly to build the request (URL slug, Authorization header), so an empty string is the same failure as an absent variable — the exact/repos//pulls/…bug is reproduced by aGITHUB_REPOSITORYthat a presence check would call "wired" the moment it is merely set to''. The token is guarded unconditionally too: every real invocation reads a PR's file list over the network, and the wiring workflow always supplies one (pinned by the existing self-test: "the wiring passes a token, without which no file list can be read").Why out of scope stays out of scope
The
NODE_USE_ENV_PROXY=1/ 403-vs-404 proxy question named at the end of the issue is not touched here — the issue itself calls it "a separate question," and the claim comment repeats the same boundary. No self-re-exec was added to this gate.Measurements
Before (original
readPrContext,PR_NUMBERset,GITHUB_REPOSITORYunset):After (this PR, same command, same env):
Reverse control (all three variables supplied — behaviour UNCHANGED, a real verdict is still returned):
--self-test(raised battery floor,'Wiring absent: never clean, never an accusation.'5 → 16, including the new missing-slug and missing-token cases and one assertion pinning the exit code as the literal number2):Gates run
node scripts/pm/dispatch-gates.mjs --commandsderived 32 commands for this diff; all 32 ran green, includingpnpm check:pm-dispatch-gates(1674 cases pass) andpnpm check:single-claim-paths(the self-test above).node scripts/check-nul-bytes.mjsalso passes.Changeset
skip-changeset— measured, not assumed: every package'spackage.jsonfiles[]publishes onlydist,README.md,CHANGELOG.md(checked across all workspace packages with afilesfield).scripts/check-single-claim-paths.mjsis a repo-root CI gate script underscripts/, notscripts/pm/**, and is not built into any package'sdist— nothing published moves.Clause-②: no
Generated by Claude Code